package com.yunhe.inspect.repository;

import com.yunhe.inspect.domain.InspectProcess;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: InspectProcessRepository
 * @Description:
 * @author: GongDaCheng
 * @Date: 17:48 2021/11/11
 */
@Repository
public interface InspectProcessRepository {

    /**
     * 新增
     * @author
     * @date 2021/11/11
     **/
    int createInspectProcess(InspectProcess inspectProcess);

    /**
     * 新增
     * @author
     * @date 2021/11/11
     **/
    int createInspectProcessSelective(InspectProcess inspectProcess);

    /**
     * 刪除
     * @author
     * @date 2021/11/11
     **/
    int deleteInspectProcessByPrimaryKey(@Param("id") int id);

    /**
     * 更新
     * @author
     * @date 2021/11/11
     **/
    int updateInspectProcessByPrimaryKey(InspectProcess inspectProcess);

    /**
     * 更新
     * @author
     * @date 2021/11/11
     **/
    int updateInspectProcessByPrimaryKeySelective(InspectProcess inspectProcess);

    /**
     * 根据主键查询
     * @author
     * @date 2021/11/11
     **/
    InspectProcess searchInspectProcessByPrimaryKey(@Param("id") int id);

    /**
     * @Description 根据巡检单id查询该巡检单的最新待复审流程信息
     * @Param int inspectOrderId
     * @Return InspectProcess
     * @Date 2021/11/12 15:04
     */
    InspectProcess getReviewProcessByOrderId(@Param("inspectOrderId") int inspectOrderId);

    /**
     * 获取最后一条流程
     * @param inspectOrderId
     * @return
     */
    InspectProcess getLatestProcessByOrderId(@Param("inspectOrderId") int inspectOrderId);

    /**
     * @Description 根据巡检单id查询历史流程
     * @Param int inspectOrderId
     * @Return List<InspectProcess>
     * @Date 2021/11/16 11:42
     */
    List<InspectProcess> getProcessHistoryByInspectOrderId(@Param("inspectOrderId") int inspectOrderId);

    /**
     * @Description 根据巡检单id查询该巡检单的流程信息
     * @Param Long inspectOrderId
     * @Return InspectProcess
     * @Date 2021/11/12 15:04
     */
    List<InspectProcess> getReviewProcessListByOrderId(@Param("inspectOrderId") Long inspectOrderId);

    //根据整改单查询对应的流程
    InspectProcess getListByRectificationId(@Param("rectificationId") Long rectificationId);
}
